﻿<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>登陆</title>
    <link href="../js/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../js/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../css/default.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="../js/jquery-1.4.4.min.js"></script>

    <script type="text/javascript" src="../js/jquery.easyui.min.js"></script>

    <script src="../js/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>

    <script src="../js/common.js" type="text/javascript"></script>

    <script type="text/javascript">
        if (top.location != self.location) top.location = self.location;

        $(function() {
            $("#login_window").window({
                title: '登陆窗口',
                closed: false,
                closable: false,
                maximizable: false,
                minimizable: false,
                collapsible: false,
                resizable: false
            });

            $("#btnLogin").click(function() {
                var paramData = {};
                paramData.username = $("#username").val();
                paramData.password = $("#password").val();
                paramData.checkcode = $("#checkcode").val();
                loginSys(paramData);
            });

            $("#btnClose").click(function() {
                window.close();
            });
            $('#imgvalidatecode').click(function() {
                this.src = '../ashx/validatecode.ashx?r=' + Math.random();
            });
        });

        //登陆操作
        function loginSys(paramData) {
            $.ajax({
                url: "../ashx/Login.ashx?Method=Login",
                data: paramData,
                beforeSend: function(xhr) {
                    return $('#form1').form('validate');
                },
                success: function(json) {
                    switch (json.isOk) {
                        case 1:
                            window.location.href = "index.aspx";
                            break;
                        case 0:
                            showError(json.message);
                            break;
                    }
                },
                error: function() {
                    showError('获取账号信息失败...请联系管理员!');
                }
            });
        }
    </script>

</head>
<body>
    <div id="login_window" class="easyui-window" closed="true" title="登陆窗口" iconcls="icon-login" style="width: 400px; height: 200px; padding: 5px;">
        <form id="form1">
        <div border="false" style="padding: 10px 10px 10px 10px; background: #fff; border: 1px solid #ccc;">
            <table align="center">
                <tr>
                    <td>
                        账号：
                    </td>
                    <td>
                        <input id="username" maxlength="20" class="easyui-validatebox" required="true" validtype="length[1,20]" />
                    </td>
                </tr>
                <tr>
                    <td>
                        密码：
                    </td>
                    <td>
                        <input type="password" id="password" maxlength="20" class="easyui-validatebox" required="true" validtype="length[1,20]" />
                    </td>
                </tr>
                <tr>
                    <td>
                        验证码：
                    </td>
                    <td>
                        <img id="imgvalidatecode" src="../ashx/validatecode.ashx" alt="点击刷新" style="vertical-align: middle;" />
                        <input type="text" id="checkcode" name="checkcode" maxlength="4" style="max-width: 40px;" class="easyui-validatebox" required="true" />
                    </td>
                </tr>
            </table>
        </div>
        <div border="false" style="text-align: center; height: 30px; line-height: 30px; margin-top: 6px;">
            <a class="easyui-linkbutton" iconcls="icon-ok" href="javascript:void(0)" id="btnLogin">登陆</a> <a class="easyui-linkbutton" iconcls="icon-no" href="javascript:void(0)" id="btnClose">关闭</a>
        </div>
        </form>
    </div>
</body>
</html>
